<!DOCTYPE html>
<html class="x-admin-sm">

<head>
  <meta charset="UTF-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport"
    content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  <link rel="stylesheet" href="./css/font.css">
  <link rel="stylesheet" href="./css/xadmin.css">
  <link rel="stylesheet" href="./lib/layui/css/layui.css">
  <script src="./lib/layui/layui.js" charset="utf-8"></script>
  <script type="text/javascript" src="./js/xadmin.js"></script>

  <style>
    html,
    body {
      margin: 0;
      padding: 0;
    }

    body {
      padding: 15px;
      background-color: #fff;
    }

    #form-add,
    #form-edit {
      padding-top: 20px;
      padding-right: 30px;
    }
  </style>



  <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
</head>

<body>
  <div class="x-nav">
    <span class="layui-breadcrumb">
      <a href="">首页</a>
      <a href="">演示</a>
      <a>
        <cite>导航元素</cite></a>
    </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
      onclick="location.reload()" title="刷新">
      <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
  </div>


  <div class="layui-fluid one1">
    <div class="layui-row layui-col-space15">

      <div class="layui-tab layui-tab-card ">

        <div class="layui-tab-content">
          <div class="layui-tab-item layui-show">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
              <ul class="layui-tab-title">
                <li class="layui-this" id="no1">文章链接</li>
                <li id="no2">图片链接 </li>
                <li style="float: right;">

                  <button type="button" id="eddd" class="layui-btn layui-btn-normal">+ 增加</button>

                </li>
              </ul>
              <div class="layui-tab-content">

                <!-- 列表区域  文章 -->
                <div class="layui-tab-item layui-show">
                  <table class="layui-table" lay-even lay-skin="line">
                    <colgroup>
                      <col name="el-table_1_column_1" width="65">
                      <col name="el-table_1_column_2" width="238">
                      <col name="el-table_1_column_3" width="237">
                      <col name="el-table_1_column_4" width="237">
                      <col name="el-table_1_column_5" width="237">
                      <col name="el-table_1_column_6" width="200">
                      <col name="gutter" width="0">
                    </colgroup>
                    <thead>
                      <tr>
                        <th>#</th>
                        <th>标题</th>
                        <th>链接描述</th>
                        <th>链接类型</th>
                        <th>链接地址</th>
                        <th id="Th">操作</th>
                      </tr>
                    </thead>
                    <tbody id="articleLink">

                    </tbody>
                  </table>
                  <div id="fenye1"></div>

                </div>


                <!-- 列表区域 图片 -->
                <div class="layui-tab-item ">
                  <table class="layui-table" lay-even lay-skin="line">
                    <colgroup>
                      <col name="el-table_1_column_1" width="65">
                      <col name="el-table_1_column_2" width="238">
                      <col name="el-table_1_column_3" width="237">
                      <col name="el-table_1_column_4" width="237">
                      <col name="el-table_1_column_5" width="237">
                      <col name="el-table_1_column_6" width="200">
                      <col name="gutter" width="0">
                    </colgroup>
                    <thead>
                      <tr>
                        <th>#</th>
                        <th>链接描述</th>
                        <th>链接图片</th>
                        <th>链接类型</th>
                        <th>链接地址</th>
                        <th id="Th">操作</th>
                      </tr>
                    </thead>
                    <tbody id="imageLink">

                    </tbody>
                  </table>
                  <div id="fenye2"></div>

                </div>




              </div>
            </div>
          </div>

        </div>
      </div>
    </div>

    </ul>




  </div>



  <!-- 新增按钮模块弹出层 -->
  <script type="text/html" id="dilog-add">
    <form class="layui-form" id="form-add">
      <div class="layui-form-item">
        <label class="layui-form-label iname"><i class="red">* </i> 链接类型</label>
        <div class="layui-input-block">
          <select name="type" lay-filter="aihao" required lay-verify="required">
            <option value="请选择"></option>
            <option value="1">文字链接</option>
            <option value="2">图片链接</option>
          </select>
        </div>
      </div>

      <div class="layui-form-item layui-form-item-text  ">
        <label class="layui-form-label iname"><i class="red">* </i>链接标题</label>
        <div class="layui-input-block">
          <input type="text" name="title" placeholder="请输入标题" autocomplete="off" class="layui-input" id="addIcon">
        </div>
      </div>


      <div class="layui-form-item">
        <label class="layui-form-label iname"><i class="red">* </i>链接地址</label>
        <div class="layui-input-block">
          <input type="text" name="url" required lay-verify="required" placeholder="请输入链接地址名称" autocomplete="off"
            class="layui-input" id="addIcon">

        </div>
      </div>



      <div class="layui-form-item">
        <label class="layui-form-label iname">
          <i class="red">* </i>链接描述
        </label>
        <div class="layui-input-block">
          <textarea name="des" placeholder="请输入内容" required lay-verify="required" class="layui-textarea"></textarea>
        </div>
      </div>



      <div class="layui-form-item layui-form-item-img">
        <label class="layui-form-label iname"><i class="red">* </i>链接图片</label>
        <div class="layui-input-block ">
          <!-- <input type="file" name="" id="text"> -->
          <input type="file" name="img" id="addd" style="display: none;" placeholder="请输入标题" autocomplete="off"
            class="layui-input" id="file">
          <button type="button" class="layui-btn layui-btn-normal " id="filebtn">选择文件</button>
        </div>
      </div>


      <div class="layui-form-item fr">
        <div class="layui-input-block">
          <button class="layui-btn layui-btn-primary">取消</button>
          <button class="layui-btn layui-bg-blue" lay-submit lay-filter="formDemo">确认</button>
        </div>
      </div>


    </form>
  </script>



  <!-- 编辑按钮弹出层 -->

  <script type="text/html" id="dilog-add1">
    <form class="layui-form" id="idinfo">

      <!-- 第一个框 -->
      <div class="layui-form-item">
        <label class="layui-form-label iname"><i class="red">* </i> 链接类型</label>
        <div class="layui-input-block">
          <select name="type" lay-filter="aihao" required lay-verify="required">
            <option value="请选择"></option>
            <option value="1">文字链接</option>
            <option value="2">图片链接</option>
          </select>
        </div>
      </div>

           <!-- 第二个框 -->
      <div class="layui-form-item layui-form-item-text  ">
        <label class="layui-form-label iname"><i class="red">* </i>链接标题</label>
        <div class="layui-input-block">
          <input type="text" name="title" placeholder="请输入标题" autocomplete="off" class="layui-input" id="addIcon">
        </div>
      </div>

      <!-- 第三个框 -->

      <div class="layui-form-item">
        <label class="layui-form-label iname"><i class="red">* </i>链接地址</label>
        <div class="layui-input-block">
          <input type="text" name="url" required lay-verify="required" placeholder="请输入链接地址名称" autocomplete="off"
            class="layui-input" id="addIcon">

        </div>
      </div>

      <!-- 第四个框 -->
      <div class="layui-form-item">
        <label class="layui-form-label iname">
          <i class="red">* </i>链接描述
        </label>
        <div class="layui-input-block">
          <textarea name="des" placeholder="请输入内容" required lay-verify="required" class="layui-textarea"></textarea>
        </div>
      </div>

      <!-- 同第四个框 链接图片 -->

      <div class="layui-form-item layui-form-item-img">
        <label class="layui-form-label iname"><i class="red">* </i>链接图片</label>
        <div class="layui-input-block ">
          <input type="file" name="img" style="display: none;" placeholder="请输入标题" autocomplete="off"
            class="layui-input" id="file">
          <button type="button" class="layui-btn layui-btn-normal " id="filebtn">选择文件</button>
        </div>
      </div>

      <div class="layui-form-item fr">
        <div class="layui-input-block">
          <button class="layui-btn layui-btn-primary">取消</button>
          <button class="layui-btn layui-bg-blue" lay-submit lay-filter="formDemo">确认</button>
        </div>
      </div>



    </form>

  </script>












  <!-- 文字渲染 -->
  <script type="text/html" id="tpl-table">
  {{each data}}
  <tr>
      <td>{{$index+1}}</td>
      <td>{{$value.title}}</td>
      <td>{{$value.des}}</td>
      {{if $value.type==1}}
      <td>文字类型</td>
      {{else}} 
      <td>图片类型</td>
      {{/if}}
      <!-- <td>{{$value.type}}</td> -->
      <td>{{$value.url}}</td>
      <td>
          <!-- 编辑按钮 -->
          <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" id="BtnEdit" data-id="{{$value.id}}">
              <div class="Icon"><i class="layui-icon layui-icon-edit" ></i> </div>
              <!-- 删除按钮 -->
          <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" id="BtnDelete" data-id="{{$value.id}}" >
             <div class="Icon"> <i class="layui-icon layui-icon-delete"></i>  </div>
        </button>

      </td>
  </tr>
  {{/each}}
</script>



  <!-- 图片渲染 -->
  <script type="text/html" id="tpl-table-img">
  {{each data}}
  <tr>
      <td>{{$index+1}}</td>
      <td>{{$value.des}}</td>
      <td>
        <img src="{{'http://192.168.21.69:8060/'+$value.img}}" alt="">
      </td>
      <!-- <td>{{$value.type}}</td> -->
      {{if $value.type==2}}
      <td>图片类型</td>
      {{else}} 
      <td>文字类型</td>
      {{/if}}
      <td>{{$value.url}}</td>
      <td>
          <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" id="BtnEdit" data-id="{{$value.id}}" style="width: 28px; height: 28px;; border-radius: 50%; background-color: #fb6d49; color: #fff;">
              <div class="Icon"><i class="layui-icon layui-icon-edit" ></i> </div> 
          <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" id="BtnDelete" data-id="{{$value.id}}" style="width: 28px; height: 28px;; border-radius: 50%; background-color: red; color: #fff;" >
             <div class="Icon"> <i class="layui-icon layui-icon-delete"></i>  </div>
        </button>
      </td>
  </tr>
  {{/each}}
</script>



  <script src="./lib/layui/layui.all.js"></script>

  <script src="./lib/template-web.js"></script>

  <script src="./js/jquery.min.js"></script>
  <script src="./js/baseAPI.js"></script>
  <script src="./js/link.js"></script>
</body>
<script>
</script>

</html>